home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MTE.ZIP / MTE.DOC < prev    next >
Text File  |  1992-04-22  |  10KB  |  256 lines

  1.  
  2. MuTation Engine <tm>
  3.  
  4. Version 1.00ß (22-04-92)
  5. (C) 1992 CrazySoft, Inc.
  6. written by Mad Maniac.
  7.  
  8. ****** This is a beta release ment only to be distributed to the  ******
  9. ****** members of Destroyers, Inc. Do not, repeat, DO NOT spread! ******
  10.  
  11. 1.  License
  12.  
  13. You are free to include this Engine in viruses.  Using it in another ways is
  14. prohibited.  You are free to give it to people that will only use it in this
  15. way.  MuTaion engine is free.
  16.  
  17.  
  18. 2.  How it works
  19.  
  20. Please read the whole document before trying to do something with the Engine.
  21. If you have never written a virus in Assembler, DON'T start with the Engine.
  22. First do this, then return back to the Engine.
  23.  
  24. MuTation Engine is an object module that could be linked to any virus.    It has
  25. been written in Assembler and assembled under Turbo Assembler 2.5.  We recommend
  26. that you use this assembler to compile the viruses that will carry the Engine.
  27. Linking it to an object file produced by other assemblers, or high-level
  28. languages compilers is theoretically possible, but we never tried and do not
  29. recommend it.  We decided NOT to give up the Engine's source code at this time.
  30.  
  31. The Engine will encrypt your code each time with a different encryption key.  It
  32. will also generate a routine to decrypt it, which will also differ each time.
  33. Both the decryption routine and the encrypted code will have variable lengths.
  34. Thus your virus will be hardly detectable.  The Engine's code is about 2KB; we
  35. believe this is not too big.
  36.  
  37.  
  38. 3.  How to use it
  39.  
  40. We assume that you will use Turbo Assembler 2.5 to compile your virus.    Put the
  41. following at the beginning of your source code:
  42.  
  43.     .model    tiny
  44.     .code
  45.  
  46.     extrn    mut_engine: near
  47.  
  48. Then you write your virus as usual.  When you need to encrypt the code, you just
  49. call the Engine.  Put the following instruction in your code:
  50.  
  51.     call    mut_engine
  52.  
  53. You also need to supply the parameters for the Engine.    They are passed in
  54. registers.  Results are also passed in registers.
  55.  
  56. Of course, you must link the MTE.OBJ module to your virus!
  57.  
  58. You can rely on the fact that the Engine will not modify itself while running,
  59. and will not need any data to be preserved between calls (except for RND_BUF,
  60. see below).
  61.  
  62.  
  63. 4. Input parameters
  64.  
  65. All parameters are mandatory.  Description follows:
  66.  
  67.    ES = Work segment
  68.  
  69. The Engine needs work space.  On entry, ES must point to a free segment.  It
  70. will use the first 2048 (MAX_LEN) bytes of it PLUS length of the code that will
  71. be encrypted.  If, for example, your virus will be 3KB in length (including the
  72. Engine!), the work segment must have at least 5120 bytes free.    The segment
  73. needs not to be initialized; it contents will be lost after calling the Engine.
  74.  
  75.    DS:DX => Code to encrypt
  76.  
  77. On entry, just set DS:DX to point to the code you want to be encrypted.
  78.  
  79.    CX = Length of code to encrypt
  80.  
  81. On entry, just set CX to the length of the code you want to be encrypted.
  82.  
  83.    BP = Offset where the decryption routine will be executed
  84.  
  85. The Engine needs to know what will be the value of IP when the decryption
  86. routine will take control.  For example, if your virus infects a COM file, and
  87. adds itself BEFORE it, you must set this value to 100h.
  88.  
  89.    DI = Offset of the code entry point
  90.  
  91. This is the offset where to pass control after the decryption routine has
  92. decrypted the encrypted code.  This is also the start offset for decrypting.
  93. The code before this offset will NOT be decrypted.  Usually, set this value to
  94. 0.
  95.  
  96.    SI = Offset from start address where the encrypted code will be
  97.  
  98. This is the offset where the encrypted code will be taken from (The decrypted
  99. code will be put immediately after the decryption routine).  If you set this
  100. value to 0, the encrypted code is assumed to be immediately after the decryption
  101. routine (this is the normal case).
  102.  
  103.    BL = Decryption routine size (1 = Tiny, 3 = Small, 7 = Medium, 15 = Big)
  104.  
  105. This affects the size and the speed of execution of the decryption routine.
  106. Only the above listed 4 values are allowed (other values will crash the Engine).
  107. Usually, set this to 0fh.
  108.  
  109.    AX = Bit field
  110.  
  111.       Bit 0 = Preserve AX \
  112.       Bit 1 = Preserve CX  \    Set each bit to 1 if you want the value of the
  113.       Bit 2 = Preserve DX   \    corresponding register to be preserved when the
  114.       Bit 3 = Preserve BX    \    decryption routine receives control.  Set it to
  115.       Bit 4 = Preserve SP    /    0 if you don't want it preserved.  Other
  116.       Bit 5 = Preserve BP   /    registers will be preserved in any case.
  117.       Bit 6 = Preserve SI  /
  118.       Bit 7 = Preserve DI /
  119.  
  120.       Bit 8 = Would probably run at different CPU
  121.  
  122. Set this bit to 1 if the decryption routine could run on another computer (this
  123. is the normal case).
  124.  
  125.       Bit 9 = Don't assume CS = DS on execution
  126.  
  127. Set this bit to 1 if you're not sure that DS will point to CS on entry to the
  128. decryption routine (this is the normal case for EXE files).  Otherwise, set it
  129. to 0.
  130.  
  131.       Bit 10 = Don't assume CS = SS on execution
  132.  
  133. Set this bit to 1 if you're not sure that SS will point to CS on entry to the
  134. decryption routine (This is the normal case for EXE files).  Otherwise, set it
  135. to 0.
  136.  
  137.       Bit 11 = Don't align encrypted code onto paragraph boundary
  138.  
  139. Set this bit to 1 if you don't care if the decrypted code is aligned on a
  140. paragraph boundary.  Otherwise, set it to 0.  Note that the value of IP will be
  141. unknown at the time when the decrypted code receives control.
  142.  
  143.  
  144. 5.  Results
  145.  
  146. The Engine returns the following values in registers (all others except for the
  147. listed below will be trashed):
  148.  
  149.    ES = Work segment
  150.  
  151. The ES value is preserved.
  152.  
  153.    DS:DX => Decryption routine + encrypted code
  154.  
  155. DS:DX now points to the decryption routine immediately followed by the encrypted
  156. code.  If SI was set to 0 on entry, the code is ready to be put in a file.  If
  157. not, you must treat separately the first DI and next CX-DI bytes (see below).
  158.  
  159.    CX = Length of the decryption routine + encrypted code
  160.  
  161. CX now has the summary length of both the decryption routine and encrypted code.
  162.  
  163.    AX = Length of the code that was encrypted
  164.  
  165. AX now has the length of the code that will be decrypted at the time when the
  166. decryption routine receives control.  This value may differ from the value that
  167. you passed in CX on entry; but it is not less than it in any case.  It might be
  168. greater with no more than 32 (MAX_ADD_LEN) bytes.  This is because of how the
  169. Engine works.
  170.  
  171.    DI = Offset of decryption routine end
  172.  
  173. This is the length of the decryption routine, and an offset where the encrypted
  174. code starts.  You might need this if SI was not set to 0 on entry.  This value
  175. is not greater than 512 (MAX_ADD) bytes.
  176.  
  177.    SI = Offset of loop start
  178.  
  179. This is an offset in the newly generated decryption routine where the decryption
  180. loop starts.  You might need it if SI was not set to 0 on entry.  If you don't,
  181. just ignore it.
  182.  
  183.  
  184. 6.  Stack usage
  185.  
  186. Before you call the Engine, make sure there is PLENTY of stack space free (256
  187. bytes appear to be enough).  For resident viruses, it is strongly recommended
  188. that you maintain your own stack.  Otherwise the chance is that you will blow
  189. the DOS stack. This will change in the final release of MtE 1.0.
  190.  
  191.  
  192. 7. Random numbers
  193.  
  194. Unfortunately, what was said above was NOT sufficient to include the Engine in
  195. your virus.  The reason is, that in order to generate random encryption keys,
  196. the Engine uses a pseudo-random number generator.  To achieve greater
  197. flexibility, we decided to include it in another object module.
  198.  
  199. You have two options:
  200.   1) To use the sample pseudo-random numbers generator, included with the Engine
  201.   2) To design your own random numbers generator
  202.  
  203.   7.1.    Using the sample generator
  204.  
  205. It is easier to choose this option.  In this case you need to link the RND.OBJ
  206. module to the virus.
  207.  
  208. Also put the following instruction at the beginning of your source code:
  209.  
  210.     extrn    rnd_buf: word
  211.  
  212. Where the virus FIRST receives control, put the following instruction:
  213.  
  214.     mov    cs:[rnd_buf],0
  215.  
  216. You also MUST ensure that the contents of RND_BUF (which is in _DATA segment)
  217. will be preserved between two calls of the Engine.
  218.  
  219. If you need pseudo-random numbers in your virus, you can use the RND_GET and
  220. RND_INIT procedures, if you declared them as externals (see below).  However,
  221. either RND_INIT or MUT_ENGINE should be called prior to calling RND_GET!
  222.  
  223.   7.2.    Designing your own generator
  224.  
  225. To do this, you need to write two procedures, RND_INIT and RND_GET.  They must
  226. be declared as publics either in your virus, or in a separate module.
  227.  
  228. RND_INIT must return a RANDOM number in AX.
  229. RND_GET must return a PSEUDO-RANDOM number in AX.
  230.  
  231. These procedures MUST preserve all registers except for AX.  If you don't
  232. understand it, don't do it.  The Engine works great with the sample generator.
  233.  
  234.  
  235. 8. Final Notes
  236.  
  237. Well, that's for now.  No time for more.  Look at the demo virus and other
  238. sample files included here to get an idea how can you use it.  After you include
  239. it in your virus, please check carefully if the Engine does what you expect it
  240. to do.    Feel free to experiment with it.  If you have problems using it, or have
  241. any comments or suggestions about it, write a message to Dark Avenger at the:
  242.  
  243. Virus eXchange BBS in Sofia
  244. Phone number: (+359)-2-20-4198
  245. Working hours: 20:00 - 06:00 GMT (in the winter)
  246.            19:00 - 05:00 GMT (in the summer)
  247.  
  248. The final release of the Engine should also be available at that BBS.
  249.  
  250. Remember do not pass the Engine to any others than the members of
  251. Destroyers, Inc.!
  252.  
  253. Greetings,
  254. CrazySoft, Inc.
  255. Bulgaria
  256.